ENT.RenderGroup = RENDERGROUP_BOTH

// Client ConVar to disable hoverball glow

CreateConVar("cl_drawhoverballs", "1")

// Include shared

include("shared.lua")

// When entity is initialized

function ENT:Initialize()
	self.Glow		     = Material("sprites/light_glow02_add")
	self.GlowDraw        = 1
	self.NextSmokeEffect = 0
end

// Draw the entity

function ENT:Draw()
	if (self.GlowDraw == 0) then return end
	
	self.BaseClass.Draw(self)	
end

// Draw translucent parts of the entity

function ENT:DrawTranslucent()
	if (self.GlowDraw == 0) then return end

	local Offset = self.Entity:GetPos()
	local PlayerEyes = LocalPlayer():EyePos()
	local Diff = (Offset - PlayerEyes):GetNormalized()
	
	render.SetMaterial(self.Glow)	
	
	local Col = Color(70, 180, 255, 255)
	
	if not (self.Entity:GetNetworkedBool("Hoverball.Activated")) then
		Col = Color(255, 60, 60, 255)
	end
	
	render.DrawSprite(Offset - Diff * 2, 48, 48, Col)
end

// Think function called every frame

function ENT:Think()
	self.GlowDraw = GetConVarNumber("cl_drawhoverballs")
end